﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CoreBDS;

namespace BatDongSan.Modules
{
    public partial class Uc_ProjectBox : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadProject();
            }
        }
        public void LoadProject()
        {
            try
            {
                List<Cvk_Project> list = ProjectBll.GetList(Utility.strConnect);
                rptProject.DataSource = list;
                rptProject.DataBind();
            }
            catch { }
        }
        protected void rptProject_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            try
            {
                if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
                {
                    Cvk_Project info = (Cvk_Project)e.Item.DataItem;
                    HyperLink hplImg = (HyperLink)e.Item.FindControl("hplImg");
                    hplImg.ImageUrl = "~/Images/Project/" + info.Img;
                    hplImg.ToolTip = info.Name;
                    hplImg.NavigateUrl = "ProjectDetail.aspx?id="+info.ProjectId.ToString();

                    HyperLink hplName = (HyperLink)e.Item.FindControl("hplName");
                    hplName.NavigateUrl = hplImg.NavigateUrl;
                    hplName.Text = info.Name;
                }
            }
            catch { }
        }
    }
}